package com.thread.test10;

/**
 * @author bin
 * @date 2025 - 03 -12
 **/
public class Account {
    private double balance = 5000;

    public Account() {
    }

    public synchronized void withdraw(double amount, String person) {
        if (amount > balance) {
            System.out.println(person + " 取款失败，余额不足");
            return;
        }
        balance -= amount;
        System.out.println(person + " 取款成功，取出：" + amount + "，剩余余额：" + balance);
    }
}
